package org.apache.ibatis.ztest.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author wangxinyuchuan
 * @version SaveMoneyProxy.java v1.0 2023/12/29 10:39 wangxinyuchuan Exp $
 */
public class SaveMoneyProxy implements InvocationHandler {

  // 代理对象
  private Object target;

  public SaveMoneyProxy(Object target) {
    this.target = target;

  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    System.out.println("准备验钞");
    System.out.println("确认无误");
    method.invoke(target, args);
    System.out.println("存钱结束");
    return null;
  }
}
